﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;
using System.Runtime.Remoting.Messaging;
namespace EllenTang.Dal
{
    public class DbContextFactory
    {
        /// <summary>
        /// 保证EllenTangEntities实例上下文唯一
        /// </summary>
        public static DbContext dbContext { get { return CreateDbContext.dbcontent; } }

        /// <summary>
        /// 防止在DbContextFactory类被调用时初始化dbContext
        /// </summary>
        class CreateDbContext
        {
            internal static readonly DbContext dbcontent =new EllenTang.Model.EllenTangEntities();
        }

    }
}
